@extends('admin.admin')

@section('content')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            广告面板设置
            <small>添加</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 控制面板</a></li>
            <li class="active">广告面板设置</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">广告添加</h3>
                        <div class="box-tools">
                            <a href="{{Route('admin.ad.index')}}" type="button" class="btn btn-block btn-success btn-xs"><i class="icon  glyphicon glyphicon glyphicon-menu-left"></i> 返回</a>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    {!! Form::model($ad,['route'=>['admin.ad.update',$ad->id],'method'=>'put'])  !!}
                    {!! Form::hidden('back_url',@$_SERVER['HTTP_REFERER']) !!}
                    <div class="box-body">

                        <div class="form-group @if($errors->has('title')) has-error   @endif">
                            <label for="exampleInputEmail1">广告标题</label>
                            {!! Form::text('title',old('title'),array('class'=>'form-control','placeholder'=>'广告标题'))!!}
                            @if($errors->has('title'))
                                <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$errors->first('title')}}</label>
                            @endif
                        </div>

                        <div class="form-group @if($errors->has('pos_id')) has-error   @endif">
                            <label for="exampleInputPassword1">广告位置</label>
                            {!! Form::select('pos_id',$adpos,old('pos_id'),['class'=>'form-control'])!!}
                            @if($errors->has('pos_id'))
                                <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$errors->first('pos_id')}}</label>
                            @endif
                        </div>

                        <div class="form-group @if($errors->has('url')) has-error   @endif">
                            <label for="exampleInputEmail1">广告链接</label>
                            {!! Form::text('url',old('url'),array('class'=>'form-control','placeholder'=>'广告链接'))!!}
                            @if($errors->has('url'))
                                <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$errors->first('url')}}</label>
                            @endif
                        </div>



                        <div class="form-group @if($errors->has('image')) has-error   @endif">
                            <label for="exampleInputEmail1">图片连接</label>
                            {!! Form::text('image',old('image'),array('class'=>'form-control','placeholder'=>'图片连接'))!!}
                            @if($errors->has('image'))
                                <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$errors->first('image')}}</label>
                            @endif
                        </div>

                        <div class="form-group">
                            <label>上传功能暂时未实现</label>
                            {!! Form::file('image', array('id'=>'exampleInputFile', 'name'=>'选择图片')) !!}
                            <label>图片预览</label><br/>
                            @if(!is_null($ad->image))
                                {!! Form::image($ad->image,old('image'), array('id'=>'exampleInputFile', 'name'=>'选择图片')) !!}
                            @endif
                        </div>

                        <div class="form-group @if($errors->has('list_order')) has-error   @endif">
                            <label for="exampleInputEmail1">位置排序</label>
                            {!! Form::text('list_order',old('list_order'),array('class'=>'form-control','placeholder'=>'位置排序'))!!}
                            @if($errors->has('list_order'))
                                <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$errors->first('list_order')}}</label>
                            @endif
                        </div>

                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="submit" class="btn btn-primary">保存</button>
                        </div>
                        {!! Form::close()  !!}
                    </div>
                    <!-- /.box -->
                </div>
            </div>



    </section>
    <!-- /.content -->
@endsection